<?php

namespace app\dao\user;

use app\dao\BaseDao;
use app\model\ShopRole;

class ShopRoleDao extends BaseDao
{
    public function getPageListByShopId($shop_id, $page, $perPage)
    {
        $query = $this->getModel()->where('shop_id', '=', $shop_id);

        return $this->pagination($query, $page, $perPage);
    }

    public function getAllByShopId($shop_id)
    {
        $query = $this->getModel()->where('shop_id', '=', $shop_id);
        return [
            'pagination' => ['page' => 1, 'perPage' => -1, 'total' => $query->count()],
            'list'       => $query->select()
        ];
    }

    protected function setModel(): string
    {
        return ShopRole::class;
    }

}